home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / prodpack.zip / DB4PPSRC.EXE / _PLSWAIT.PRG < prev    next >
Text File  |  1993-05-04  |  3KB  |  81 lines

  1. PROCEDURE _PlsWait
  2. PARAMETERS pc_msg
  3. *----------------------------------------------------------------------------
  4. * NAME
  5. *   _PlsWait - Display a "Please wait" box.
  6. *
  7. * SYNOPSIS
  8. *   DO _PlsWait WITH <pc_msg>
  9. *
  10. * DESCRIPTION
  11. *   _PlsWait will display the <pc_msg> string in a box and display
  12. *   a centered "Please wait..." message.  This is useful to display
  13. *   during operations that may take a long time such as re-indexing.
  14. *   The window will always be centered in the screen.
  15. *
  16. * PARAMETERS
  17. *   pc_msg - the message to display in the box.  If the length is
  18. *            greater than 76, the trailing part is chopped off.
  19. *
  20. * EXAMPLE
  21. *   DO _PlsWait WITH "Re-indexing files"
  22. *   Displays the message in a window as follows at row 9 on the screen:
  23. *                           +-------------------+
  24. *                           |                   |
  25. *                           | Re-indexing files |
  26. *                           |                   |
  27. *                           |  Please wait...   |
  28. *                           |                   |
  29. *                           +-------------------+
  30. *   Note that the width of the window can increase to accomodate a longer
  31. *   message string.
  32. *
  33. * LIMITATIONS
  34. *   Truncates the message after 76 characters.  Assumes an 80 character
  35. *   wide screen.  Looks best with SET CURSOR OFF.
  36. *
  37. *   Note also that for speed, _PlsWait simply creates and activates
  38. *   a window named _PlsWait.  It is up to the calling program to
  39. *   subsequently DEACTIVATE and RELEASE this window.  Also for speed,
  40. *   _PlsWait assumes that the window _PlsWait does not already exist.
  41. *
  42. *----------------------------------------------------------------------------
  43.  
  44.   PRIVATE lc_msg, lc_plswait, ln_msglen, ln_width
  45.  
  46.   lc_plswait = [Please wait...]
  47.   ln_plslen = LEN( lc_plswait )
  48.   lc_msg = LTRIM( RTRIM( pc_msg ) )     && Trimmed message
  49.   ln_msglen = LEN( lc_msg )             && Trimmed length of message
  50.   ln_width = 0                          && Window, then display, width
  51.  
  52.   *-- Determine if we need to make a wider window:
  53.   IF ln_msglen <= ln_plslen
  54.     ln_width = ln_plslen
  55.   ELSE
  56.  
  57.     *-- Make sure the message fits in the window:
  58.     IF ln_msglen > 76
  59.       lc_msg = LEFT( lc_msg, 76 )
  60.       ln_msglen = 76
  61.     ENDIF
  62.  
  63.     ln_width = ln_msglen
  64.   ENDIF
  65.  
  66.   lc_CoMess = _ColorChk( "M" )
  67.   DEFINE WINDOW _PlsWait FROM 9, ((76 - ln_width) + .5) / 2 ;
  68.                 TO 15, (ln_width + 83) / 2 DOUBLE ;
  69.      COLOR &lc_CoMess
  70.  
  71.   ln_width = ( ln_width + 2 )           && Width of window area.
  72.  
  73.   *-- Display the message and prompt to the window and wait for a key press
  74.   ACTIVATE WINDOW _PlsWait
  75.   @ 1, ( ln_width - ln_msglen ) / 2 SAY lc_msg
  76.   @ 3, ( ln_width - ln_plslen ) / 2 SAY lc_plswait
  77.  
  78. RETURN
  79. *-- EOP: _PlsWait WITH pc_msg
  80.  
  81.